fix: prevent extension from hanging when embedder service is unavailable #8779
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR attempts to address Issue #8777 where the extension would get stuck loading indefinitely when the embedder service is unavailable.
Problem
When the CodeIndexManager cannot connect to the embedder service, the extension gets stuck loading and never fully activates until all folders in the VSCode workspace fail. This prevents users from using the extension UI even to fix configuration issues.
Solution
The fix involves two key changes:
Non-blocking initialization: Changed the CodeIndexManager initialization from blocking (await) to non-blocking (using .catch()) during extension activation. This allows the extension to fully activate even if the embedder service is unavailable.
Timeout for embedder validation: Added a 5-second timeout to the embedder validation process using Promise.race(). This prevents indefinite hanging when trying to connect to an unavailable service.
Changes Made
src/extension.tsto make CodeIndexManager initialization non-blockingsrc/services/code-index/service-factory.tsto add a 5-second timeout to embedder validationTesting
Related Issues
Fixes #8777
Feedback and guidance are welcome!
Important
Fixes extension hanging by making
CodeIndexManagerinitialization non-blocking and adding a timeout to embedder validation.CodeIndexManagerinitialization insrc/extension.tschanged to non-blocking using.catch()to prevent extension hanging.validateEmbedder()inservice-factory.tsusingPromise.race()to avoid indefinite hanging.src/extension.tsfor debugging when connection fails.This description was created by
for 0ac7f5a. You can customize this summary. It will automatically update as commits are pushed.